<%= render :partial => @post %>

<p>
	<%= link_to '&Eacute;diter', edit_post_path(@post) %> &bull;
	<%= link_to 'Supprimer',  @post, :method => :delete, :confirm => I18n.t('unvariant.sure') %> &bull;
	<%= link_to 'Voir tous les articles', posts_path %>
</p>

<h2 class="comment_form" id="no_puce">
	<% if @post.comments.length > 1 %>
		<%= I18n.t("comments.title_plug") %>
	<% else %>
		<%= I18n.t("comments.title") %>
	<% end %>
</h2>
<ul id="comment_form_parent" class="no_puce">
	<li class="no_puce">
		<div id="comments" class="comment_form">
			<%= render :partial => @post.comments %>
		</div>
	</li>
</ul>

<a href="#" id="comment_form" class="comment_form" onClick="return false;">
	<%= I18n.t("comments.titles.add") %>
</a>

<% remote_form_for [@post, Comment.new], :html => { :onsubmit => "jPCommentForm.dialog( 'close' )" } do |f| %>
	<p>
		<%= f.label :body, "Nouveau commentaire" %><br />
		<%= f.text_area :body %>
		<br /><br />
		<%= f.submit "Ajouter le commentaire" %>
	</p>
<% end %>

<script type="text/javascript">
	//"
	var jTextareaCommentBody = jQuery( 'textarea#comment_body' ),
		jcCommentForm = jQuery( '.comment_form' ),
		jPCommentForm = jQuery( 'form.new_comment' ),
		jACommentForm = jQuery( 'a#comment_form' ),
		jCommentId = jQuery( '.comment_id' );

	jTextareaCommentBody
		.resizable(
			{
				containment:'parent'
			});

	jcCommentForm
		.sortable(
			{
				containment: 'parent'
			})
		.disableSelection();

	jPCommentForm
		.dialog(
			{
				autoOpen:	false,
				bgiframe:	true,
				modal:		true,
				title:		'Nouveau commentaire',
				height:		515,
				width:		430,
				position:	'top',
				containment:'parent',
				rezisable:	true
			});

	jACommentForm
		.click(function ()
			{
				jPCommentForm.dialog( 'open' );
			});

	var allCommentId = 0;
	jCommentId
		.each(function ()
			{
				allCommentId++;
				jQuery( this ).html( 'Commentaire #' + allCommentId + '&nbsp;&bull;' );
			});
</script>